import request from '@/utils/request'

// 技能分类API
export const skillCategoryApi = {
  // 根据ID查询技能分类
  queryById(id) {
    return request({
      url: `/admin/skill-category/${id}`,
      method: 'GET'
    })
  },

  // 分页查询技能分类
  queryPage(pageNum, pageSize, params = {}) {
    return request({
      url: '/admin/skill-category/page',
      method: 'POST',
      params: {
        pageNum,
        pageSize
      },
      data: params
    })
  },

  // 创建技能分类
  create(data) {
    return request({
      url: '/admin/skill-category',
      method: 'POST',
      data
    })
  },

  // 更新技能分类
  update(id, data) {
    return request({
      url: `/admin/skill-category/${id}`,
      method: 'PUT',
      data
    })
  },

  // 删除技能分类
  delete(id) {
    return request({
      url: `/admin/skill-category/${id}`,
      method: 'DELETE'
    })
  }
}

// 技能API
export const skillApi = {
  // 根据ID查询技能
  queryById(id) {
    return request({
      url: `/admin/skill/${id}`,
      method: 'GET'
    })
  },

  // 分页查询技能
  queryPage(pageNum, pageSize, params = {}) {
    return request({
      url: '/admin/skill/page',
      method: 'POST',
      params: {
        pageNum,
        pageSize
      },
      data: params
    })
  },

  // 根据条件查询技能列表
  queryList(params) {
    return request({
      url: '/admin/skill/list',
      method: 'POST',
      data: params
    })
  },

  // 创建技能
  create(data) {
    return request({
      url: '/admin/skill',
      method: 'POST',
      data
    })
  },

  // 更新技能
  update(id, data) {
    return request({
      url: `/admin/skill/${id}`,
      method: 'PUT',
      data
    })
  },

  // 删除技能
  delete(id) {
    return request({
      url: `/admin/skill/${id}`,
      method: 'DELETE'
    })
  },

  // 批量删除技能
  deleteBatch(ids) {
    return request({
      url: '/admin/skill/batch',
      method: 'DELETE',
      data: ids
    })
  }
}
